package org.d10_data_stream;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * 目标：使用数据输入流读取特定类型的数据
 */
public class DataInputStreamTest2 {
    public static void main(String[] args) {
        try (

         DataInputStream dis = new DataInputStream
                    (new FileInputStream("D:\\idea\\idea code\\java-practice\\practice\\change\\file-oi-app\\src\\test\\d9test.txt"));

        ){
            //一定要按照前面写入的顺序
            int i = dis.readInt();
            System.out.println(i);

            double d = dis.readDouble();
            System.out.println(d);

            boolean b = dis.readBoolean();
            System.out.println(b);

            String s = dis.readUTF();
            System.out.println(s);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
